package com.example.helloworld.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
//默认情况下，@RestController注解会将返回的对象数据转换为JSON格式。
public class HelloController {

    //localhost:8080/hello

    @GetMapping("/hello")//get方法,相当于@RequestMapping(value = "/hello",method = RequestMethod.GET)
    public String hello(){
        return "123hello";
    }

    @RequestMapping(value = "/h",method = RequestMethod.GET)
    public String h(String name, String phone){
        System.out.println(name);
        return "hello" + name + phone;
    }
}
